Skip to content

vtk field for release#4859

Closed
thewtex wants to merge 1 commit intoInsightSoftwareConsortium:release-5.4from
thewtex:vtk-field-for-release
Closed

vtk field for release#4859
thewtex wants to merge 1 commit intoInsightSoftwareConsortium:release-5.4from
thewtex:vtk-field-for-release

Conversation

@thewtex
Copy link
Copy Markdown
Member

@thewtex thewtex commented Sep 24, 2024

Support .vtk PolyData FIELD entries.

@github-actions github-actions Bot added type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots area:IO Issues affecting the IO module labels Sep 24, 2024
@thewtex thewtex changed the base branch from master to release-5.4 December 13, 2024 18:17
Add reading of VTK legacy FIELD data entries in both POINT_DATA
and CELL_DATA sections. When FIELD data is present and the number
of tuples matches the point/cell count, the data is read as a
VariableLengthVector pixel type.

Only the first field data array per section is used; additional
arrays are silently skipped. Add a test with a gourd.vtk file
that exercises the FIELD data path.

Co-authored-by: Matt McCormick <matt@mmmccormick.com>
@hjmjohnson
Copy link
Copy Markdown
Member

Hi @thewtex — opened #6188 as a forward-port of this PR onto main, with the bug that was making itkMeshFileReadWriteTestField fail now fixed. Authorship preserved via GIT_AUTHOR_*. Will close this once #6188 lands.

@hjmjohnson
Copy link
Copy Markdown
Member

Closing — superseded by #6188, which forward-ports this work to main and fixes the bug that made itkMeshFileReadWriteTestField fail (the Read{Point,Cell}DataBuffer helpers weren't consuming the FIELD array-header line). Authorship preserved via GIT_AUTHOR_*. Reopen if you'd prefer the fix to also land on release-5.4.

@hjmjohnson hjmjohnson closed this May 2, 2026
hjmjohnson added a commit to hjmjohnson/ITK that referenced this pull request May 2, 2026
Add reading of VTK legacy FIELD data entries in both POINT_DATA
and CELL_DATA sections.  When FIELD data is present and the number
of tuples matches the point/cell count, the data is read as a
VariableLengthVector pixel type.

`ReadMeshInformation` detects the `FIELD FieldData N` keyword and
parses the first array's header (`<name> <numComponents> <numTuples>
<dataType>`) to set the IO metadata.  The matching
`Read{Point,Cell}DataBufferAs{ASCII,BINARY}` helpers now also consume
that array-header line after the `FIELD` keyword so the actual data
block lines up; without that step `itkMeshFileReadWriteTestField`
fails because the reader treats the array header as data.

Only the first field-data array per section is used; additional
arrays are silently skipped.  Add a test with a `gourd.vtk` file
that exercises the FIELD data path.

Forward-port of InsightSoftwareConsortium#4859 from `release-5.4` to `main`.

Co-Authored-By: Matt McCormick <matt@mmmccormick.com>
Co-Authored-By: Hans Johnson <hans-johnson@uiowa.edu>
hjmjohnson added a commit to hjmjohnson/ITK that referenced this pull request May 2, 2026
Add reading of VTK legacy FIELD data entries in both POINT_DATA
and CELL_DATA sections.  When FIELD data is present and the number
of tuples matches the point/cell count, the data is read as a
VariableLengthVector pixel type.

`ReadMeshInformation` detects the `FIELD FieldData N` keyword and
parses the first array's header (`<name> <numComponents> <numTuples>
<dataType>`) to set the IO metadata.  The matching
`Read{Point,Cell}DataBufferAs{ASCII,BINARY}` helpers now also consume
that array-header line after the `FIELD` keyword so the actual data
block lines up; without that step `itkMeshFileReadWriteTestField`
fails because the reader treats the array header as data.

Only the first field-data array per section is used; additional
arrays are silently skipped.  Add a test with a `gourd.vtk` file
that exercises the FIELD data path.

Forward-port of InsightSoftwareConsortium#4859 from `release-5.4` to `main`.

Co-Authored-By: Matt McCormick <matt@mmmccormick.com>
Co-Authored-By: Hans Johnson <hans-johnson@uiowa.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:IO Issues affecting the IO module type:Infrastructure Infrastructure/ecosystem related changes, such as CMake or buildbots

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants